<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script crossorigin src="https://unpkg.com/react@18/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
    <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
</head>

<body>
    <div id="root"></div>
    <script type="text/babel">
    //先创建节点
    const root = ReactDOM.createRoot(document.querySelector("#root"));
    let message = "我是傻逼";
     function handleClick()
     {
          message = "我是天才";
          root.render((<div>
          <h2>{message}</h2>
          <button onClick={handleClick}>修改文本</button></div>));
 
     }
  
     root.render((<div>
    <h2>{message}</h2>
    <button onClick={handleClick}>修改文本</button></div>));

    
    </script>
</body>

</html>